﻿define('persons',
    ['jquery', 'ko', 'basicObject', 'person', 'personsSearch'],
function ($, ko, basicObject, person, personsSearch) {
    var persons = function () {
        var self = this;
        var dateCellTemplate = '<span data-bind="css: \'kgCellText\', dateshower: $data.getProperty($parent)" />';
        var linkCellTemplate = '<div style="width: 100px"><a data-bind="css: \'kgCellText fill\'">Edit<a></div>';
        var columnsDefs = [
            { field: 'idnp', displayName: 'Idnp', width: '15%' },
            { field: 'lastName', displayName: 'Last name', width: '43%' },
            { field: 'firstName', displayName: 'First name', width: '43%' },
            { field: 'dateBirth', cellTemplate: dateCellTemplate, displayName: 'Date birth', width: '20%' },
            { field: 'id', cellTemplate: linkCellTemplate, displayName: 'Edit', width: '15%' }
        ];

        self.basicObject = ko.observable(new basicObject(columnsDefs, person, personsSearch, "/api/Persons/GetByPage", "currentView", "Person"));

    };

    return persons;

});